
app.controller('payedDataCtrl', ['$scope', function($scope) {
	var needNewPagination = true;
	getData(1);
	
	function getData(pageNo) {
		var startTime = $.trim($("#start-time").val());
		var endTime = $.trim($("#end-time").val());
		
		var param = {
			startTime: startTime,
			endTime: endTime,
			pageNo: pageNo,
			pageCount: 20,
		};
		AQ.callAQJSON("lookPayedTask.do", param, function(result) {
			var data = result.data;
			$scope.$apply(function () {
				$scope.listData = data;
				if(pageNo == 1 && needNewPagination) {	//创建分页
					var num_entries = 500;
					Utils.newPagination("Pagination", num_entries, function(page_index, jq) {
						if(page_index == 0 && needNewPagination) {
							needNewPagination = false;
							return;
						}
						getData(page_index+1);
					});
				}
			});
		}, function(err, code) {
			Utils.msgDialog(err + "["+ code +"]");
		});
	}
	
	$("#query-data").click(function() {
        getData(1);
    });
	
}]);
